/* Copyright (C) 2010-2011 Chi-kwan Chan
   Copyright (C) 2010-2011 NORDITA

   This file is part of sg2.

   Sg2 is free software: you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   Sg2 is distributed in the hope that it will be useful, but WITHOUT
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
   License for more details.

   You should have received a copy of the GNU General Public License
   along with sg2.  If not, see <http://www.gnu.org/licenses/>. */

#include <stdlib.h>
#include "sg2.h"

Z Np, Nsp;
R *xxp,*yyp,*vxp,*vyp;
R *Dxxp,*Dyyp,*Dvxp,*Dvyp;

void setup_particles(Z np, Z nsp)
{

  Np = np;
/* If we have non-zero particles, then we solve for particles. */
  if(Np >= 1){ 
    Nsp = nsp+1;
/* If nsp = 0 that implies we have tracer particles, for any higher values of 
   nsp we always solve for a set of tracer particles.*/
    cudaMalloc(&xxp, sizeof(R) * Np * Nsp ); 
    cudaMalloc(&yyp, sizeof(R) * Np * Nsp );
    cudaMalloc(&vxp, sizeof(R) * Np * Nsp ); 
    cudaMalloc(&vyp, sizeof(R) * Np * Nsp );
    if(Nsp >=1){
      cudaMalloc(&Dvxp, sizeof(R) * Np * Nsp ); 
      cudaMalloc(&Dvyp, sizeof(R) * Np * Nsp );
    }
  }
}
